package com.cmonbaby.binding.sample.base;

import android.content.Context;
import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewbinding.ViewBinding;

/**
 * Activity父类
 *
 * @param <V> ViewBinding
 */
public abstract class BaseActivity<V extends ViewBinding> extends AppCompatActivity {

    protected V viewBinding;
    protected Context context;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        viewBinding = getViewBinding();
        context = this;
        if (viewBinding != null) setContentView(viewBinding.getRoot());
    }

    protected abstract V getViewBinding();

}
